package simplyrugby.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import simplyrugby.entity.Skill;
import simplyrugby.mapper.SkillMapper;
import simplyrugby.service.SkillService;

/**
* @author admin
* @description 针对表【skill(技能)】的数据库操作Service实现
* @createDate 2025-03-29 18:38:09
*/
@Service
public class SkillServiceImpl extends ServiceImpl<SkillMapper, Skill>
    implements SkillService{

    @Override
    public Page<Skill> list(Integer pageNum, Integer pageSize, Skill skill) {
        LambdaQueryWrapper<Skill> wrapper = Wrappers.lambdaQuery(Skill.class)
                .eq(!ObjectUtils.isEmpty(skill.getId()), Skill::getId, skill.getId())
                .like(!ObjectUtils.isEmpty(skill.getName()), Skill::getName, skill.getName());

        Page<Skill> page = new Page<>(pageNum, pageSize);
        this.page(page, wrapper);
        return page;
    }
}




